/**********************************************
*  Namespace: AI
*  Classes:   SteeringLookAtDir
*  Desc:      Updates orientation to look at 
*			  direction of movement
*  Author:    Vaios Kalpias-Ilias (C) 2008-2009
***********************************************/

#include "SteeringLookAtDir.h"
#include "SteeringAlign.h"
namespace AI
{
	//---------------------------------------------
	/**
	* Ctor
	*/
	SteeringLookAtDir::SteeringLookAtDir()
	{
	}
	//---------------------------------------------
	/**
	* Dtor
	*/
	SteeringLookAtDir::~SteeringLookAtDir()
	{
	}
	//---------------------------------------------
	/**
	* Returns new kinematic data in 2d
	*/
	Steering2d SteeringLookAtDir::GetSteering(const Kinematic2d& current)
	{
		if (current.velocity.Length() == 0)
			return Steering2d();

		Kinematic2d target(current);
		target.orientation = atan2(-current.velocity.x, current.velocity.y);

		return SteeringAlign::GetSteering(current, target);
	}

}
